#include "EntityContour.h"
#include "BaseDef.h"

CEntityContour::CEntityContour()
{
	m_pdmEntity=0;
	m_dmNewVector.reserve(10);
	m_dmNewVector.clear();
}

CEntityContour::CEntityContour(CdmEntityBase* pdmEntity)
{
	m_pdmEntity=pdmEntity;
	m_dmNewVector.reserve(10);
	m_dmNewVector.clear();
}

CEntityContour::~CEntityContour()
{
	EntVectCList begin=m_dmNewVector.begin();
	EntVectCList end=m_dmNewVector.end();
	while (begin<end)
	{
		(*begin)->Delete();
		m_dmNewVector.erase(begin);
		begin=m_dmNewVector.begin();
		end=m_dmNewVector.end();
	}
}

CEntityContour& CEntityContour::operator = (const CEntityContour& other)
{
	if(this==&other) return* this;
	m_pdmEntity=other.m_pdmEntity;
	copy(other.m_dmNewVector.begin(),other.m_dmNewVector.end(),
		inserter(m_dmNewVector,m_dmNewVector.end()));
	return *this;
}

void CEntityContour::SetEntity(CdmEntityBase* pdmEntity)
{
	m_pdmEntity=pdmEntity;
}

void CEntityContour::PushNewEntity(CdmEntityBase* pNewEntity)
{
	m_dmNewVector.push_back(pNewEntity);
}

int  CEntityContour::GetNewCount()
{
	return m_dmNewVector.size();
}

CdmEntityBase* CEntityContour::GetItem(int index)
{
	if(index<0||index>m_dmNewVector.size()-1) return 0;
	return m_dmNewVector[index];
}